The idea of a "war inside heaven" was invented in the 3rd century BCE, when apocalyptic ideas began to flourish, notably with writings such as Enoch and Jubilees.
The idea was promoted by the Dead Sea Community (Esseenes?), who said that war events on earth reflected wars in heaven. Later Jewish writings, especially Revelation, continued the ideas.
Most Christian beliefs find their genesis in that period, generally known as the Second Temple Period -- rather than from the canonised Hebrew Scriptures. For example, the present-day ideas about Satan, which is relevant to the "war in heaven", comes from this Second Temple Period. The being named Satan in the OT is not the source of present-day ideas.
I do not know if the problem of Theodicy played a part in the rise of this 3rd century BCE apocalyptic movement. It likely was aided by the failure of the Jews to achieve their self-appointed expectations, which were thwarted by Greece in particular. The Book of Daniel, which was written in the 2nd century BCE (164 BCE) is the direct outcome of that political oppression combined with the apocalyptic fervour that had arisen a century earlier.
Doug